package xyz.eden.cloud.common.web.did.impl.def;

import xyz.eden.cloud.common.web.did.IdGenComponent;
import xyz.eden.cloud.common.web.did.enums.IdType;

import java.util.Objects;

/**
 * 默认 id 生成器
 */
public class IdGenComponentByDefault implements IdGenComponent {
    @Override
    public boolean isSupport(IdType idType) {
        return Objects.equals(idType, IdType.DEFAULT) || Objects.isNull(idType);
    }

    @Override
    public Long getId() {
        return System.nanoTime();
    }

    @Override
    public String getStrId() {
        return String.valueOf(System.nanoTime());
    }
}
